<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAppleTreesRecordsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('apple_trees_records', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('apple_tree_id')->index()->default(0);
            $table->unsignedBigInteger('user_id')->index()->default(0);
            $table->decimal('money', 10, 2)->nullable()->default(0);
            $table->decimal('dividend_money', 20, 10)->nullable()->default(0);
            $table->dateTime('expired_at')->nullable();
            $table->dateTime('paid_at')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('apple_trees_records');
    }
}
